home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 5 / Apprentice-Release5.iso / Environments / Prograph Classic 2.6.1 / Prograph Tutorial Manual / Prograph Tutorial / Prograph Tutorial.rsrc / TEXT_165.txt < prev    next >
Encoding:
Text File  |  1995-10-16  |  17.6 KB  |  312 lines

  1. t    Prograph Development Styles
  2.  
  3. *73*The approach you take in Prograph application*69* development can be influenced by your personal preferences and whether or not you work in a development group that follows a prescribed work procedure. The next two sections of this tutorial demonstrate that Prograph is a viable development environment regardless of the approach you take in creating your applications.
  4.  
  5. If you put the styles of application development along a continuum, the end points would be anchored with structured analysis and requirements-based development at one end and dynamic, evolutionary*70* development at the other end. The structured approach is generally associated with a ‚Äútop-down‚Äù strategy, while the evolutionary 
  6. approach is associated with an ‚Äúoutside-in‚Äù or ‚Äúlook-to-feel‚Äù strategy.
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18. The structured methodology begins with analysis and design. No code is written until the overall project is rigorously specified. Programmers often work on modules of a larger application with high-level dataflow diagrams and process-specification documents guiding their implementation.
  19.  
  20. The evolutionary approach is most often associated with creative, prototyping styles of development. Very often this dynamic strategy is used in research settings in which the goal of development is to explore new ideas, as in interface design. Since the objective is exploratory, no exact specification of the end result is provided as it is in the structured method. In the structured approach, no code is written until everything is specified. In the evolutionary approach, some code is written and interacted with. This leads to refinement and extension based on new insights, more code, and more interaction. 
  21.  
  22. More and more, the evolutionary approach is being adopted in commercial software development by those creative individuals or programming groups who have ideas for a ‚Äúbetter mousetrap‚Äù and jump right into bringing them about. 
  23.  
  24. Although you may personally favor one approach or the other based upon the way in which you currently work, neither approach is all right or wrong, better or worse than the other. The structured and evolutionary styles each have appropriate uses. Very often, a combination of both styles is required to actually get the application put together.
  25.  
  26. As you read the next two sections of this tutorial, keep in mind how you wish to approach Prograph programming. If you fall more into one camp than the other, your usual approach will, of course, at first look better than any other. But, the facts are, both approaches to Prograph application development work for those who know and use them. And most of us fall somewhere between‚Äîusing the method that is appropriate to the conditions and requirements of the task at hand.
  27.  
  28. t    Prograph Structured Development 
  29.  
  30. *72*If you are part of a development organization currently using a structured, analytic approach to application design and implementation, you already have a set of procedures that prescribe your development cycle. This section of the tutorial is not about to teach or to promote a specific approach to structured analysis. Rather, you should be able to see that Prograph fits well into such established development cycles.
  31.  
  32. As an example, take a brief look at a simple banking system presented in an article by*97* Sidney Bailin (‚ÄúAn Object-Oriented Requirements Specification Method,‚Äù Communications of the ACM, 32: 5, [May 1989], pp. 608-23). Bailin‚Äôs article makes a thoughtful case for reconciling structured analysis and design with object-oriented development. We‚Äôll use Bailin‚Äôs argument and briefly show how high-level Entity Dataflow Diagrams (EDFD) can be implemented quickly and directly in Prograph‚Äôs visual environment.
  33.  
  34. In Bailin‚Äôs system, an external, real world customer interacts with the computerized banking system through keyed-in transactions (a 24-hour teller machine, for example) and by receiving mailed statements of his or her account.
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49. The physical customer is modeled into the system as a customer object and the account is represented as another class of object. The labeled dataflow lines between the customer and account objects indicate the general categories of interaction that relate the customer and account within the system.
  50.  
  51. For purposes of this example, we focus on decomposition of the Account object as it relates to the flow of transactions from the customer. A second-level EDFD, following Bailin, further specifies the account object‚Äôs function.
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72. Features of the Prograph development environment that facilitate the application of a structured-analysis-and-design approach include:
  73.  
  74. o    Prograph‚Äôs visual, dataflow method specification naturally maps onto high-level design specifications.
  75.  
  76. o    Prograph‚Äôs free-form text-comment facilities, especially the comment propagation feature, provide an unparalleled level of integrated system documentation encouraging consistency and reducing errors.
  77.  
  78. o    Prograph‚Äôs ability to nest method and local-method calls within method and local-method calls is directly applicable to functional decomposition techniques associated with structured-analysis-and-design methods.
  79.  
  80. o    Prograph‚Äôs ability to incorporate existing procedural-language modules, written in C, into Prograph as user-defined primitives allows Prograph to function as a high-level Computer Assisted Software Engineering (CASE)-type environment to organize and extend existing systems without rewriting tried and true code.
  81.  
  82. o    Prograph‚Äôs object-orientation and dataflow features provide a unique integration of object-oriented design and structured-analysis methodologies, an area of intense research interest that other environments are having difficulty reconciling.
  83.  
  84. How would a programmer implement Bailin‚Äôs banking system in Prograph? A first cut at this implementation involves creation of the required classes. Attributes of the new Customer and Account classes are defined. In addition, two Window subclasses are created to provide the user interface to allow customer-transaction entry and account-manager statement production.
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111. Next, closer inspection of the decomposition of the Account EDFD suggests some initial methods.
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122. Analyzing the 2.1 Update Account node of the EDFD diagram, some assumptions are made about the internal specification of the Update Account method.
  123.  
  124. o    Its input-bar root delivers either a customer transaction event or another bank‚Äôs forwarding of a customer‚Äôs check event.
  125.  
  126. o    The method updates attribute information related to the account of the customer who initiates the transaction or whose check has come in.
  127.  
  128. o    If the transaction causes an overdraft, the bad-check chain of events is initiated.
  129.  
  130. If this simple banking system were to be further decomposed, the tasks that make up the high-level Update Account node would be specified, giving a third and more deeply nested view into the updating procedure for accounts. In the screen shots below, you see local methods are used to encapsulate collections of subtasks that occur during the update.
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153. Notice that an extensive, multiline comment has been used on each method‚Äôs input bar to provide a complete project-identification and implementation record including important dates and approval sign-offs. In addition, EDFD numerical node identifiers have been placed on each operation in the Prograph methods.
  154.  
  155. This example is not intended to be comprehensive or fully presented. Rather, it is to give you a sense of how Prograph and its flexible environment can be appropriately used in a structured-design-and-analysis method of large application development.
  156.  
  157. If this is the style of development you or your group uses, you will have no trouble finding ways to incorporate Prograph into your existing procedures. However, if you want to use Prograph in a more organic style of programming, continue on to the next section.
  158.  
  159. t    Prograph Evolutionary Development
  160.  
  161. *71*More and more programming today is being done by individuals. The lone programmer pursues an entrepreneurial dream of writing the next great revolutionary piece of commercial software. Many pursue independent projects as part of academic, industrial, or commercial research. Others program simply for the joy and self-development of it.
  162.  
  163. If you fit into one of these categories, you will find much to like about Prograph, as it supports the style of programming we earlier characterized as dynamic evolutionary development. The primary general characteristic of the editor/interpreter environment supporting this fluid style of application development is Prograph‚Äôs seamless integration.
  164.  
  165. Seamless integration means that you are free to do what needs to be done when it needs to be done. *874*You are not locked into a rigid set of procedures that can stifle creativity and reduce productivity.*928* 
  166.  
  167. Typical programming environments are highly modal, in Macintosh terms. That is, you have to do one thing at a time, moving from editing to compiling to running to debugging, and so on. If you make a change, you have to cycle through a sequence of time-consuming steps to see the result of your change.
  168.  
  169. As you have already experienced, Prograph is extremely flexible in letting you create and edit aspects of your application on-the-fly, evolving your application by stepping easily back and forth from your application environment to the Prograph editors. In the Grand Tour of Application Builder (chapter 3) you specified a click method for a button and were greeted by this dialog:
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180. as you interacted with your fledgling application by clicking the Add button. 
  181.  
  182. And you have created a new method simply by making a calling operation with the new method‚Äôs name within the case window of an existing method. Double-clicking on the left side of this operation creates the new method and opens its case window with input and output comments propagating to the new method.
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204. This dynamic creation of instances and methods is complemented by the on-the-fly creation of persistents as well as new classes and their attributes. When used in combination with Application Builder, you have the unique ability to shape and reshape a complex interface and underlying computations without exiting and rerunning your application.
  205.  
  206. u    Open the System Classes file to start with a fresh Application Builder environment.
  207.  
  208. u    Enter the Application editor and name your new application Gizmo Maker.
  209.  
  210. u    This example application does not require any menus, but it is good form to supply at least a minimal menu bar. The System Classes file comes with a minimal File menu with a single item named Quit with a /Quit method and a Q command-key equivalent. Together with the default Apple menu, this gives you bare-bones menuing for the Gizmo Maker application.
  211.  
  212. u    Add a Window instance that looks like this to your application:
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.  
  228. u    Set the Make button‚Äôs click method to /Make. The lower right side Window Item instance is a Scroll Text instance that you should name Gizmo Display. (Note this item is not a Scroll List like you put in your Folks Database window.) Be sure to click the Wrap check box in the Scroll Text editor. The New Gizmo Specs label is a simple, unnamed Text item. Don‚Äôt forget to add this window to the Active List so it is visible when you execute your application.
  229.  
  230. u    Press OK to dismiss the Application editor, and then execute your application.
  231.  
  232. u    Click the Make button and press Return twice to indicate that you do want to create the new Make method in class Window. When the Make method execution window pops up, open its case window and edit it to look like this:
  233.  
  234.  
  235.  
  236.  
  237.  
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247. u    Open a case window on the make Gizmo local method and edit it to look like this:
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265. u    Activate the Make execution window and press Return to start stepping through the new method‚Äôs operations. When the make Gizmo local method is ready to execute, press Shift-Return to pop down into this local‚Äôs execution window.
  266.  
  267. u    Due to Prograph‚Äôs inherent concurrency, there is no way to know the exact order in which execution will attempt to create the Gizmo class, the Gizmo Inventory persistent, and the Gizmo attributes thingamabob and part#. So:
  268.  
  269.  ‚Ä¢ When prompted by a dialog that asks if you want to create a new Gizmo class, press Return to accept the default OK response.
  270.  
  271.  ‚Ä¢ When prompted by a dialog that asks if you want to create a new Gizmo Inventory persistent, press Return to accept the default OK response. Immediately, the Value of Persistent Gizmo Inventory pops up with a NULL current value. Scroll the Data Types list upward and click on the list item to prepare the inventory to store a list of Gizmo instances in inventory.
  272.  
  273.  ‚Ä¢ When the Ask primitive is executed, it pops up a dialog. Press OK to accept the default text chrome.
  274.  
  275.  ‚Ä¢ As both the Get and Set operations are executed, press Return to indicate you want to create these attributes in class Gizmo. Press Return to accept the default Instance selection at the dialog that asks for the type of the new attribute. Press Return at the Value of Attribute thingamabob to leave its default value at NULL. But at the Value of Attribute part#, enter 900-9 and press Return, as all Gizmo instances are assigned this number. (You may have noticed that the use of a Get operation on the part# attribute does not serve any useful purpose in this example. The point was for you to see that dynamic attribute-creation works for both Set and Get operations.)
  276.  
  277. u    Continue pressing Return to step all the way through the make Gizmo local and Make method. As the Make method‚Äôs execution concludes, the Gizmo Maker window‚Äôs Scroll Text item is updated to show that you have just created a new Gizmo instance, part number 900-9, with a chrome thingamabob! Pretty remarkable when you consider that you started with nothing more than the shell of a window that could not do anything useful before you made it happen‚Äîall on the fly while your application was running.
  278.  
  279. This dynamic creation of instances, methods, persistents, and even classes and their attributes in conjunction with Application Builder allows you to develop elaborate user interfaces and complex applications quickly and easily.
  280.  
  281. Features of the Prograph development environment that encourage this dynamic evolutionary approach to application development include:
  282.  
  283. o    Prograph‚Äôs seamless integration of concurrent execution of your developing application and Prograph‚Äôs editors stimulate creativity and productivity, since your programming can keep up with the flow of your ideas.
  284.  
  285. o    Application Builder‚Äôs built-in event-loop processing lets you keep your creative energy focused on the things you are trying to get your application to do. You don‚Äôt get bogged down in the obscure technical implementation of the Macintosh Toolbox and operating-system facilities.
  286.  
  287. o    The Application editor‚Äôs Set Defaults button makes it easy to define the default values of attributes of a new subclass by using an existing instance of its superclass as a template.
  288.  
  289. o    Prograph dynamically creates new instances, methods, and classes as you execute your application. This allows you to move your initial development forward by creating only the things your application needs to run at its current level of development. Without this feature, you can find yourself guessing, creating classes and methods you think you will need, only to find that you don‚Äôt need them after all. 
  290.  
  291. o    Selective and incremental loading encourage productive reuse and sharing of classes and methods developed for other applications. You don‚Äôt waste thought and energy reinventing.
  292.  
  293. As you see from the list above, dynamic, creative, evolutionary development by an individual or small group is largely facilitated by features that increase productivity. A programming environment that works with you is the primary tool in getting the job done. 
  294.  
  295. As you gain more experience with Prograph and Application Builder, you probably will evolve your own list of Prograph benefits. This personal list of benefits will be greatly affected by the style of Prograph programming you develop. The goal of these last few sections of this tutorial has been to demonstrate that Prograph has a wide range of features to fit your style, whatever it may be.
  296.  
  297. t    Check Your Progress
  298.  
  299. *0150*Congratulations on completing this chapter. Once learned, Application Builder is a powerful tool for the rapid development of Macintosh applications. It is, however, a rich collection of facilities that may be completely new to most programmers.
  300.  
  301. The effort you put into understanding Application Builder and its System classes will be repaid by painless, productive Prograph programming.
  302.  
  303. In this tutorial, you have learned:
  304.  
  305. 4 how to use Prograph‚Äôs Application Builder to by-pass tedious, error-prone low-level Macintosh programming
  306.  
  307. 4 about the structure and function of the Prograph System Classes and how they are used in the Application Builder
  308.  
  309. 4 how Prograph enhances your application development productivity for structured as well as evolutionary-development styles of programming.
  310.  
  311. If you still feel a little unsure about some topics covered in this tutorial, review the material and skim relevant portions of the Reference manual. We also strongly urge you to take a look at some of the examples provided on the Prograph distribution disks; in particular, the files in the Learning Prograph folder are very useful to beginning Prographers. The Simple Examples file contains methods that illustrate Prograph controls, loops, primitives and general tips and techniques on the language itself. The SysClass Examples file contains examples of how to work with each of the supplied System Classes, including creating a draw method for a Canvas using Macintosh Toolbox calls.
  312.